package com.dingup.provider.mapper;

import com.dingup.api.adapter.classInfo.ClassInfoAdapter;
import com.dingup.api.bean.query.classInfo.ClassInfoForPkBean;
import com.dingup.api.bean.requestBean.classInfo.ClassPageBean;
import com.dingup.api.enums.ClassStatusEnum;
import com.dingup.api.enums.ClassUserTypeEnum;
import com.dingup.api.model.classInfo.ClassInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ClassInfoMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(ClassInfo record);

    int insertSelective(ClassInfo record);

    ClassInfo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ClassInfo record);

    int updateByPrimaryKey(ClassInfo record);

    ClassInfo getByClassName(String className);

    List<ClassInfo> getClassInfo(@Param("classPageBean") ClassPageBean classPageBean, @Param("createUserIds")List<String> createUserIds);

    List<ClassInfo> getClassInfoByQuery(@Param("query") String query, @Param("createUserIds")List<String> createUserIds);

    List<ClassInfo> getClassInfoByLessonIdAndStatus(@Param("lessonId") Integer lessonId, @Param("status")ClassStatusEnum status);

    List<ClassInfo> getUnEndClass();

    List<ClassInfo> getClassByLessonId(Integer lessonId);

    List<ClassInfoAdapter> getClassInfoAdapter(@Param("classId") Integer classId, @Param("ifNeedEnd") Boolean ifNeedEnd);

    List<ClassInfo> getClassInfoForPK(ClassInfoForPkBean bean);

    List<ClassInfo> getAllClassInfoUnDelete();

    /**
     * 获取用户所在的班级
     *
     * @param userId
     * @param type
     * @return
     */
    List<ClassInfo> getClassInfoByTeacherId(@Param("userId") String userId,
                                            @Param("type") ClassUserTypeEnum type);

    /**
     * 获取id不在集合中的班级
     *
     * @param classIds
     * @return
     */
    List<ClassInfo> getClassInfoNorIn(@Param("classIds") List<Integer> classIds);

    List<ClassInfo> getByLessonIdAndUserId(@Param("lessonId") Integer lessonId,
                                           @Param("userId") String userId,
                                           @Param("type") ClassUserTypeEnum type);
}